package aoptest.withoutaop;

import org.springframework.util.StopWatch;

public class WorkerBeanWithoutAop {
	public void doSomeWork1(int noOfTimes) {
		// start the stop watch
		StopWatch sw = new StopWatch();
		sw.start("doSomeWork1");
		
		//your business logic
		for (int x = 0; x < noOfTimes; x++) {
			work();
		}
		
		// stop the stop watch
		sw.stop();
		System.out.println("Took: " + sw.getTotalTimeMillis() + " ms");
	}

	public void doSomeWork2(int noOfTimes) {
		// start the stop watch
		StopWatch sw = new StopWatch();
		sw.start("doSomeWork2");
		
		//your business logic
		for (int x = 0; x < noOfTimes; x++) {
			work();
		}
		
		// stop the stop watch
		sw.stop();
		System.out.println("Took: " + sw.getTotalTimeMillis() + " ms");
	}
	
	private void work() {
		System.out.print("");
	}
}
